package com.qdairlines.common;


/**
 * @author xiuge
 * @Description:返回值及返回描述
 * @date 2016年7月11日上午9:27:33
 */
public enum Options {

    UnSubmit(0, "默认未提交", "states"),
    RegisterSuccess(1, "入会成功", "states"),
    RegisterFaild(2, "入会成功", "states"),


    Deleted(1, "已删除", "delFlag"),
    NotDel(0, "未删除", "delFlag"),;

	
	


    private int code;

    private String description;

    private String tag;

    Options(int code, String description, String tag) {
        this.code = code;
        this.description = description;
        this.tag = tag;
    }

    public int getCode() {
        return this.code;
    }

    public String getDescription() {
        return this.description;
    }

    public String getTag() {
        return this.tag;
    }


    public static Options stateOf(int index) {

        for (Options state : values()) {
            if (state.getCode() == index) {
                return state;
            }
        }
        return null;
    }

    public static String getDescByTag(Integer code, String tag) {
        if (code == null) {
            return "";
        }
        for (Options state : values()) {
            if (state.getCode() == code && state.getTag().equals(tag)) {
                return state.getDescription();
            }
        }
        return "";
    }


}
